package coreconcurrency.local;

/**
 * create by yongli on 2022-08-27 17:29
 */

public class ThreadLocalTest {

    public static ThreadLocal<String> name= new ThreadLocal<>();

    public static void main(String[] args) throws Exception{

        // 底层是有一个map来存储ThreadLocal的
        OnePlus onePlus  = new OnePlus();
        Thread th1 = new Thread(()->onePlus.test());
        th1.start();
        Thread th2 = new Thread(()->onePlus.test());

        name.remove();

        th1.sleep(1000);
        th2.start();

    }
}
